package com.work.service;

import com.work.bean.Student;
import com.work.bean.StudentDTO;
import com.work.dao.StudentDao;
import com.work.dao.StudentDaoImpl;

import java.util.List;

public class StudentServiceImpl implements StudentService {

    StudentDao studentDao = new StudentDaoImpl();

    @Override
    public boolean insertService(Student stu) throws Exception {
        return studentDao.addStu(stu) > 0 ? true : false;
    }

    @Override
    public boolean uptStu(Student stu) throws Exception {
        return studentDao.uptStu(stu) > 0 ? true : false;
    }

    @Override
    public boolean delStu(int sid) throws Exception {
        return studentDao.delStu(sid) > 0 ? true : false;
    }

    @Override
    public List<Student> selectAll() throws Exception {
        return studentDao.selectAll();
    }

    @Override
    public List<String> findSname() throws Exception {
        return studentDao.findSnameList();
    }

    @Override
    public Student findStuById(String sid) throws Exception {
        return studentDao.findStuById(sid);
    }

    @Override
    public int findCount() throws Exception {
        return studentDao.findCount();
    }

    @Override
    public List<Student> findPramStu(String sid, String sname, String ssex) throws Exception {
        return studentDao.findPramStu(sid,sname,ssex);
    }

    @Override
    public List<Student> findScoreStu(StudentDTO studentDTO) throws Exception {
        return studentDao.findScoreStu(studentDTO);
    }
}
